package Client;

/*
 * Author: Anthony Fleshner
 * 
 * ControlComponent.java:
 * Handles drawing the robot controls
 */


import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTabbedPane;
import javax.swing.event.*;
import javax.swing.JTextField;

//import Server.ButtonListener;


public class ControlComponent extends JPanel{
    
    RobotComponent robot;
    JRadioButton paintToggle;
    JRadioButton mouseToggle;

    JTextField ipField;
    JTextField portField;
    JButton ipEnter;
    JRadioButton delayToggle;
    public ControlComponent(RobotComponent rob){
    	
        this.robot = rob;
        
        this.setSize(new Dimension(130,500));
        this.setPreferredSize(new Dimension(130,500));
        this.setVisible(true);
        
        //this.setLayout(new GridLayout(3, 1));
        ipField = new JTextField(10);
        ipField.setText("localhost");
        this.add(new JLabel("IP:"));
        this.add(ipField);
        portField = new JTextField(10);
        portField.setText("5000");
        this.add(new JLabel("Port:"));
        this.add("5000", portField);
        ipEnter = new JButton("Connect");
        ipEnter.addActionListener(new ButtonListener(robot, this));
        this.add(ipEnter);
        delayToggle = new JRadioButton("Delay");
        delayToggle.setFont(new Font("sansserif",Font.PLAIN,15));
        delayToggle.addActionListener(new ButtonListener(rob, null));
        this.add(delayToggle);
    }

    public RobotComponent getRobot() {
        return robot;
    }
    
    public JRadioButton getPaintToggle(){
    	return paintToggle;
    }
}
